{extend name="layout/common_layout" /}
{block name="body"}

<style>
    .layui-form-item {
        margin-bottom: 5px;
        float: left;
    }
    .layui-form-label {
        padding: 3px 15px;
        width: 200px;
    }
    .layui-input-block {
        margin-left: 242px;
        min-height: 36px;
        width: 70%;
    }
    .set_btn{ padding: 0 45px;}
</style>

<!--tab标签-->
<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title">
        <li class="layui-this">参数配置</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form form-container" action="{:url('admin/Systemparameter/updatedOrAdd')}" method="post">
                <div class="layui-form-item">
                    <label class="layui-form-label">人民币跟美金之间的兑换比例</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_rmb_dollar_exchange" value="{$data[0]['s_rmb_dollar_exchange']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">微信收款二维码：</label>
                    <div class="layui-input-block">
                        <button type="button" id="upload-photo-btn" class="layui-btn">上传二维码</button>
                        <div id="photo-container">
                            {if condition="!empty($data[0]['s_weixin'])"}
                            <div class="photo-list">
                                <input type="text" name="photo[]" style="display: none;"  value="{$data[0]['s_weixin']}" class="layui-input layui-input-inline">
                                <img src="{$data[0]['s_weixin']}" style="width: 100px;"/>
                                <button type="button" class="layui-btn layui-btn-danger remove-photo-btn">移除</button>
                            </div>
                            {/if}
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">支付宝收款二维码：</label>
                    <div class="layui-input-block">
                        <button type="button" id="upload-photo-btn1" class="layui-btn">上传二维码</button>
                        <div id="photo-container1">
                            {if condition="!empty($data[0]['s_alipay'])"}
                            <div class="photo-list">
                                <input type="text" name="photo[]" style="display: none;"  value="{$data[0]['s_alipay']}" class="layui-input layui-input-inline">
                                <img src="{$data[0]['s_alipay']}" style="width: 100px;"/>
                                <button type="button" class="layui-btn layui-btn-danger remove-photo-btn">移除</button>
                            </div>
                            {/if}
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">二级产生收益利率</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_second_level" value="{$data[0]['s_second_level']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">三级产生收益利率</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_third_level" value="{$data[0]['s_third_level']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">四级产生收益利率</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_fouth_level" value="{$data[0]['s_fouth_level']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">提现手续费（百分比）</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_service_harge" value="{$data[0]['s_service_harge']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">每天发布的证券数量</label>
                    <div class="layui-input-block">
                        <input type="number" name="s_project_num" value="{$data[0]['s_project_num']}" required lay-verify="required" class="layui-input">
                    </div>
                </div>
                <!--该值为1的时候  添加    该值为2的时候  修改-->
                <input type="hidden" name="status" value="{$status}"  class="layui-input">

                <div class="layui-form-item" style="margin-top: 50px;">
                    <div class="layui-input-block">
                        <button class="layui-btn set_btn" lay-submit lay-filter="*">更新</button>
                        <!--<button type="reset" class="layui-btn layui-btn-primary set_btn">重置</button>-->
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<!--<script src="__JS__/kindeditor/kindeditor.config.js"></script>-->
<!--<script src="__JS__/kindeditor/kindeditor-all-min.js"></script>-->
<script src="__JS__/ueditor/ueditor.config.js"></script>
<script src="__JS__/ueditor/ueditor.all.min.js"></script>
{/block}
{block name="script"}
<script>

    var timestamp = Date.parse(new Date())/1000;
    $(".nowtime").val(timestamp);

    //文件上传
    layui.upload({
        url: "/index.php/api/upload/upload",
        type: 'file',
        elem:'#attar',
        success: function (data) {
            if (data.error === 0) {
                /* document.getElementById('file').value = data.url;*/
            } else {
                layer.msg(data.message);
            }
        }
    });
    //微信收款二维码
    $(function() {
        var ue = UE.getEditor('content'),
                uploadEditor = UE.getEditor('upload-photo-btn'),
                photoListItem,
                uploadImage;

        uploadEditor.ready(function () {
            uploadEditor.setDisabled();
            uploadEditor.hide();
            uploadEditor.addListener('beforeInsertImage', function (t, arg) {
                $.each(arg, function (index, item) {
                    photoListItem = '<div class="photo-list"><input style="display: none;" type="text" name="photo[]" value="' + item.src + '" class="layui-input layui-input-inline">';
                    photoListItem += '<img src="' + item.src + '" style="width:100px;"/>';
                    photoListItem += '<button type="button" class="layui-btn layui-btn-danger remove-photo-btn">移除</button></div>';

                    $('#photo-container').append(photoListItem).on('click', '.remove-photo-btn', function () {
                        $(this).parent('.photo-list').remove();
                    });
                });
            });
        });

        $('#upload-photo-btn').on('click', function () {
            uploadImage = uploadEditor.getDialog("insertimage");
            uploadImage.open();
        });
    });
    //支付宝收款二维码
    $(function() {
        var ue = UE.getEditor('content'),
                uploadEditor = UE.getEditor('upload-photo-btn1'),
                photoListItem,
                uploadImage;

        uploadEditor.ready(function () {
            uploadEditor.setDisabled();
            uploadEditor.hide();
            uploadEditor.addListener('beforeInsertImage', function (t, arg) {
                $.each(arg, function (index, item) {
                    photoListItem = '<div class="photo-list"><input style="display: none;" type="text" name="photo[]" value="' + item.src + '" class="layui-input layui-input-inline">';
                    photoListItem += '<img src="' + item.src + '" style="width:100px;"/>';
                    photoListItem += '<button type="button" class="layui-btn layui-btn-danger remove-photo-btn">移除</button></div>';

                    $('#photo-container1').append(photoListItem).on('click', '.remove-photo-btn', function () {
                        $(this).parent('.photo-list').remove();
                    });
                });
            });
        });

        $('#upload-photo-btn1').on('click', function () {
            uploadImage = uploadEditor.getDialog("insertimage");
            uploadImage.open();
        });
    });
</script>
{/block}